import torch
from torch import nn
from PyCmpltrtok.common import sep

sep()
drop = nn.Dropout(p=0.2)
x = torch.ones(1, 10)
print(x)

sep('model.train()')
drop.train()
print(drop(x))

sep('model.eval()')
drop.eval()
print(drop(x))

sep('model.train(True)')
drop.train(True)
print(drop(x))

sep('model.train(False)')
drop.train(False)
print(drop(x))

"""
----------------------------------------------------------------
tensor([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]])
--------------------------------model.train()--------------------------------
tensor([[1.2500, 1.2500, 1.2500, 0.0000, 1.2500, 0.0000, 1.2500, 1.2500, 1.2500,
         1.2500]])
--------------------------------model.eval()--------------------------------
tensor([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]])
--------------------------------model.train(True)--------------------------------
tensor([[1.2500, 1.2500, 0.0000, 1.2500, 1.2500, 1.2500, 1.2500, 1.2500, 0.0000,
         0.0000]])
--------------------------------model.train(False)--------------------------------
tensor([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]])
"""